﻿using System;
using System.Collections.Generic;
using System.Text;
using AudioPlayer.Plugin.Storage;

namespace AudioPlayer.Storage {
	/// <summary>
	/// Playlist
	/// </summary>
	public class Playlist : IPlaylist {
		#region Fields
		private Guid _guid;
		private IList<ISong> _list;
		private string _name;
		private string _description;
		private bool _loaded;
		private bool _primary;
		private bool _userdefined;
		#endregion
		#region Constructor
		public Playlist() {
			_list = new List<ISong>();
			_guid = Guid.NewGuid();
		}
		#endregion
		#region Public Voids
		/// <summary>
		/// Adds song to playlist
		/// </summary>
		/// <param name="song">The Song.</param>
		public void Add(ISong song) {
			_list.Add(song);
		}

		/// <summary>
		/// Removes song from playlist.
		/// </summary>
		/// <param name="song">The song.</param>
		public void Remove(ISong song) {
			_list.Remove(song);
		}

		/// <summary>
		/// Determines if songs exists.
		/// </summary>
		/// <param name="song">The song.</param>
		/// <returns></returns>
		public bool Exists(ISong song) {
			return _list.Contains(song);
		}

		

		#endregion
		#region Property
		/// <summary>
		/// Gets or sets the GUID.
		/// </summary>
		/// <value>The GUID.</value>
		public Guid Guid {
			get { return _guid; }
			set { _guid = value; }
		}
		/// <summary>
		/// Gets or sets the name.
		/// </summary>
		/// <value>The name.</value>
		public string Name {
			get { return _name; }
			set { _name = value; }
		}
		/// <summary>
		/// Gets or sets the description.
		/// </summary>
		/// <value>The description.</value>
		public string Description {
			get { return _description; }
			set { _description = value; }
		}
		/// <summary>
		/// Gets or sets a value indicating whether this <see cref="IPlaylist"/> is loaded.
		/// </summary>
		/// <value><c>true</c> if loaded; otherwise, <c>false</c>.</value>
		public bool Loaded {
			get { return _loaded; }
			set { _loaded = value; }
		}
		/// <summary>
		/// Gets or sets a value indicating whether this <see cref="IPlaylist"/> is primary.
		/// </summary>
		/// <value><c>true</c> if primary; otherwise, <c>false</c>.</value>
		public bool Primary {
			get { return _primary; }
			set { _primary = value; }
		}
		/// <summary>
		/// Gets or sets a value indicating whether users defined.
		/// </summary>
		/// <value><c>true</c> if user defined; otherwise, <c>false</c>.</value>
		public bool UserDefined {
			get { return _userdefined; }
			set { _userdefined = value; }
		}

		/// <summary>
		/// Gets or sets the <see cref="AudioPlayer.Plugin.Storage.ISong"/> at the specified index.
		/// </summary>
		/// <value></value>
		public ISong this[int index] {
			get {
				return _list[index];
			}
			set {
				_list[index] = value;
			}
		}
		/// <summary>
		/// Gets or sets the <see cref="AudioPlayer.Plugin.Storage.ISong"/> with the specified song.
		/// </summary>
		/// <value></value>
		public ISong this[string song] {
			get { return null; }
			set {
			}
		}
		/// <summary>
		/// Gets the count.
		/// </summary>
		/// <value>The count.</value>
		public int Count {
			get { return _list.Count; }
		}
		#endregion
	}
}
